/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2024/9/6
 * Time: 22:14
 */

#ifndef DATAHANDLE_H
#define DATAHANDLE_H

#include "IDataHandle.h"
#include <QtCore>
#include <QtSql>

class DataHandle : public IDataHandle
{
public:
    DataHandle();

    ~DataHandle() override;

    bool AddUser(const UserInfoSPtr & _info) override;

    bool RemoveUser(const std::string & _id) override;

    UserInfoSPtr FindUser(const std::string & _id) override;

    bool AddGroup(const GroupInfoSPtr & _info) override;

    bool RemoveGroup(const std::string & _id) override;

    GroupInfoVec FindGroupWithNameLike(const std::string & _name) override;

    GroupInfoVec FindGroupWithIDLike(const std::string & _id) override;

    bool JoinGroup(const std::string & _group_id, const std::string & _user_id) override;

    bool ExitGroup(const std::string & _group_id, const std::string & _user_id) override;

    bool ModifyGroupMemberRole(const std::string & _group_id, const std::string & _user_id, GroupInfo::Type _type) override;

    GroupInfo::Type UserType(const std::string & _group_id, const std::string & _user_id) override;

    bool        MemberIsExist(const std::string & _group_id, const std::string & _user_id) override;

    UserInfoVec Members(const std::string & _group_id) override;

private:
    QString sql_database_;
};

#endif//DATAHANDLE_H
